package org.wyn.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;


public abstract class BaseAction extends ActionSupport {
	public static final String NO_AUTHORITY = "no_authority";
	//struts2 Action接口中已经有了 不需要
	//public static final String SUCCESS = "success";
	//public static final String ERROR = "error";
	public static final String BACK = "back";
	public static final String NO_LOGIN = "no_login";

	protected String errorInfo;
	protected String redirectUrl;
	protected String backUrl;
	protected String returnInfo;
	protected String returnString;

	public void setReturnInfo(String returnInfo) {
		this.returnInfo = returnInfo;
	}

	public String getReturnInfo() {
		return returnInfo;
	}

	public void setBackUrl(String backUrl) {
		this.backUrl = backUrl;
	}

	public String getBackUrl() {
		return backUrl;
	}

	public void setRedirectUrl(String redirectUrl) {
		this.redirectUrl = redirectUrl;
	}

	public String getRedirectUrl() {
		return redirectUrl;
	}

	public void setErrorInfo(String errorInfo) {
		this.errorInfo = errorInfo;
	}

	public String getErrorInfo() {
		return errorInfo;
	}

	//分类id
	protected String cateId;
	protected int cp;
	protected String keyword;
	protected int pp;
	protected String beginTime;
	protected String endTime;
	protected String sort;
	//上传路径
	protected String packagePath = "/manager/upload";
	
	protected void output(String str) {
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("utf-8");
		PrintWriter out = null;
		try {
			out = response.getWriter();
			out.write(str);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	protected void output(int n) {
		output(String.valueOf(n));
	}

	public String getCateId() {
		return cateId;
	}

	public void setCateId(String cateId) {
		this.cateId = cateId;
	}

	public int getCp() {
		return cp;
	}

	public void setCp(int cp) {
		this.cp = cp;
	}

	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public int getPp() {
		return pp;
	}

	public void setPp(int pp) {
		this.pp = pp;
	}

	public String getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(String beginTime) {
		this.beginTime = beginTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getReturnString() {
		return returnString;
	}

	public void setReturnString(String returnString) {
		this.returnString = returnString;
	}

	public String getPackagePath() {
		return packagePath;
	}

	public void setPackagePath(String packagePath) {
		this.packagePath = packagePath;
	}

	
}